﻿@{
    StatusMessageData statusMessageData = ViewData["statusMessageData"] as StatusMessageData;
}
<div id="bannedDialog">
    @Html.StatusMessage(statusMessageData)
    @using (Html.BeginAjaxForm("BannedUsers", "ControlPanelUser", FormMethod.Post, new AjaxFormOptions { DataType = AjaxDataType.Json, OnErrorCallBack = "error", OnSuccessCallBack = "success" }))
    {
        @Html.Hidden("UserIds");
        <div class="tnc-dailog-pd">
            <div class="tn-form tn-label-right tnc-label-short">
                <div class="tn-form-row">
                    <label class="tn-form-label">
                        截止日期：</label>
                    @Html.DatePicker("BanDeadline", Request.Form.Get<DateTime?>("BanDeadline", null))
                </div>
                <div class="tn-form-row">
                    <label class="tn-form-label">
                        封禁原因：</label>
                    @Html.DropDownList("reasons","请选择")
                </div>
                <div class="tn-form-row">
                    <label class="tn-form-label"></label>                   
                    @Html.TextArea("BanReason", Request.Form.Get<string>("BanReason", string.Empty), InputWidthTypes.Medium)
                </div>
            </div>
        </div>
        <div class="tnc-artdilog-btn tn-bg-gray tn-border-gray tn-border-top">
            @Html.Button("确认", ButtonTypes.Submit, HighlightStyles.Primary)
            @Html.Button("取消", ButtonTypes.Cancel, HighlightStyles.Secondary, htmlAttributes: new { dialogOperation = "close" })
        </div>
    }
</div>
@*todo:ful by libsh,不要起这样的变量名【已修复】*@
<script type="text/dialog">
    this.title("封禁设置");   
</script>
<script type="text/javascript">
    $(document).ready(function () {

        var userId = 0;
        $("input[name='CheckBoxGroup']:checked").each(function () {
            userId += $(this).val() + ',';
        });
        $("#UserIds").val(userId);

        $("#reasons").change(function () {
            $('#BanReason').html(this.options[this.selectedIndex].text);
        });
    });

    function error(data) {
        $("#bannedDialog").replaceWith(data);
    }

</script>
